package com.hengpeng.itfinbase.persist;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.ManyToMany;

import com.hengpeng.common.web.annotation.HtmlInput;
import com.hengpeng.common.web.annotation.HtmlInputPattern;
import com.hengpeng.common.web.annotation.HtmlInputType;
import com.hengpeng.itfinbase.en.RewardLevel;
import com.hengpeng.itfinbase.en.RewardType;
import com.hengpeng.itfinbase.en.RewardUseType;
import com.hengpeng.itfinbase.idAssign.AbstractAssign18IdEntity;

/**
 * 奖品信息表
 * 
 * @author weiyuan
 */
@Entity
public class Reward extends AbstractAssign18IdEntity {

    /**
     * 
     */
    private static final long serialVersionUID = -6976803970140937713L;
    /**
     * 奖品名称
     */
    @Column(length = 200)
    @HtmlInput(label = "奖品名称", type = HtmlInputType.TEXT, nullable = false, index = 1)
    private String rewardName;
    /**
     * 奖品类别
     */
    @Column(length = 50)
    @HtmlInput(label = "奖品类别", type = HtmlInputType.SELECT, nullable = false, index = 2, labelProperty = "text")
    @Enumerated(javax.persistence.EnumType.STRING)
    private RewardType rewardType;
    /**
     * 关联活动
     */
    @ManyToMany(mappedBy = "rewards", fetch = FetchType.EAGER)
    private List<Activity> activitys = new ArrayList<Activity>();

    /**
     * 奖品值，-1代表前端用户指定 利率：小数格式存储 金额：以分为单位进行存储
     */
    @Column(length = 50)
    @HtmlInput(label = "奖品值", type = HtmlInputType.TEXT, nullable = false, pattern=HtmlInputPattern.FLOAT,index = 6)
    private String rewardVal;
    /**
     * 奖品最大值 利率：小数格式存储 金额：以分为单位进行存储
     */
    @Column(length = 50)
    @HtmlInput(label = "奖品最大值", type = HtmlInputType.TEXT, nullable = false,pattern=HtmlInputPattern.FLOAT, index = 7)
    private String maxRewardVal;
    /**
     * 奖品使用返还方式
     */
    @Column(length = 50)
    @HtmlInput(label = "奖品使用返还方式", type = HtmlInputType.SELECT, nullable = false, index = 3, labelProperty = "text")
    @Enumerated(javax.persistence.EnumType.STRING)
    private RewardUseType rewardUseType;

    @Column(length = 20)
    @HtmlInput(label = "奖品等级", type = HtmlInputType.SELECT, nullable = false, index = 4, labelProperty = "text")
    @Enumerated(javax.persistence.EnumType.STRING)
    private RewardLevel rewardLevel;

    /**
     * 奖品使用期限，单位：天
     */
    @Column(length = 10)
    @HtmlInput(label = "奖品使用期限(天)", type = HtmlInputType.TEXT,pattern=HtmlInputPattern.INT, nullable = false, index = 5)
    private int deadLine;
    @HtmlInput(label = "奖品创建时间", type = HtmlInputType.TEXT, nullable = false, pattern=HtmlInputPattern.DATETIME, index = 7)
    private Date createTime;
    
    @HtmlInput(label = "奖品更新时间", type = HtmlInputType.TEXT, nullable = true, index = 8)
    private Date updateTime;

    public List<Activity> getActivitys() {
        return activitys;
    }

    public void setActivitys(List<Activity> activitys) {
        this.activitys = activitys;
    }

    public String getMaxRewardVal() {
        return maxRewardVal;
    }

    public void setMaxRewardVal(String maxRewardVal) {
        this.maxRewardVal = maxRewardVal;
    }

    public RewardLevel getRewardLevel() {
        return rewardLevel;
    }

    public void setRewardLevel(RewardLevel rewardLevel) {
        this.rewardLevel = rewardLevel;
    }

    public int getDeadLine() {
        return deadLine;
    }

    public void setDeadLine(int deadLine) {
        this.deadLine = deadLine;
    }

    public String getRewardName() {
        return rewardName;
    }

    public void setRewardName(String rewardName) {
        this.rewardName = rewardName;
    }

    public RewardType getRewardType() {
        return rewardType;
    }

    public void setRewardType(RewardType rewardType) {
        this.rewardType = rewardType;
    }

    public String getRewardVal() {
        return rewardVal;
    }

    public void setRewardVal(String rewardVal) {
        this.rewardVal = rewardVal;
    }

    public RewardUseType getRewardUseType() {
        return rewardUseType;
    }

    public void setRewardUseType(RewardUseType rewardUseType) {
        this.rewardUseType = rewardUseType;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

}
